﻿<script type="text/javascript">

    $(function() {
        $("#ruku_tuiku_chaxun").click(function() {
            //查询
            var dateKaiShi = $("#ruku_tuiku_date_kaishi").datetimebox('getValue');
            var dateJieShu = $("#ruku_tuiku_date_jieshu").datetimebox('getValue');
            var danWeiStr = $("#ruku_tuiku_danweimingcheng").combobox('getText');
            var wuLiaoStr = $('#ruku_tuiku_wuliaomingcheng').combobox('getText');
            var xingHaoStr = $("#ruku_tuiku_xinghao").combobox('getText');
            var chePaiHaoStr = $("#ruku_tuiku_chepaihao").textbox('getText');
            var zhanDianStr = $("#ruku_tuiku_zhandian").combobox('getText');

            $("#ruku_tuiku_mingxi").datagrid("load", { zhandian: zhanDianStr, chengzhongleixing: '入库物料', kaishishijian: dateKaiShi, jieshushijian: dateJieShu, danweimingcheng: danWeiStr, wuliaomingcheng: wuLiaoStr, xinghao: xingHaoStr, chepaihao: chePaiHaoStr, uid: window.uid, kid: window.kid });
        });
        $("#ruku_tuiku_daochu").click(function() {
            //导出
            var dateKaiShi = $("#ruku_tuiku_date_kaishi").datetimebox('getValue');
            var dateJieShu = $("#ruku_tuiku_date_jieshu").datetimebox('getValue');
            var danWeiStr = $("#ruku_tuiku_danweimingcheng").combobox('getText');
            var wuLiaoStr = $('#ruku_tuiku_wuliaomingcheng').combobox('getText');
            var xingHaoStr = $("#ruku_tuiku_xinghao").combobox('getText');
            var chePaiHaoStr = $("#ruku_tuiku_chepaihao").textbox('getText');
            var zhanDianStr = $("#ruku_tuiku_zhandian").combobox('getText').replace('#','_');
            var yongHu = $("#currentUser").text();
            window.open(encodeURI("http://keaomds.com:10001/?uid=" + window.uid + "&kid=" + window.kid + "&requestType=8&keHuBianHao=" + window.kehubianhao + "&zhandian=" + zhanDianStr + "&chengzhongleixing=入库物料&kaishishijian=" + dateKaiShi + "&jieshushijian=" + dateJieShu + "&danweimingcheng=" + danWeiStr + "&wuliaomingcheng=" + wuLiaoStr + "&xinghao=" + xingHaoStr + "&chepaihao=" + chePaiHaoStr + "&yonghu=" + yongHu));
        });

        $("#ruku_tuiku_zhandian").combobox({
            url: 'json/zhandian.json',
            method: 'get',
            valueField: 'zhandian',
            textField: 'zhandian',
            panelWidth: 150,
            panelHeight: 'auto',
            editable: false,
            onLoadSuccess: function() {
                $("#ruku_tuiku_mingxi").datagrid({ url: "handler/bangfangtuiku.ashx", method: "get", queryParams: { zhandian: $('#ruku_tuiku_zhandian').combobox('getValue'), chengzhongleixing: '入库物料', kaishishijian: $("#ruku_tuiku_date_kaishi").datetimebox('getValue'), jieshushijian: $("#ruku_tuiku_date_jieshu").datetimebox('getValue'), uid: window.uid, kid: window.kid }, height: document.body.scrollHeight - 200 });
            }
        });

        $("#ruku_tuiku_danweimingcheng").combobox({
            url: 'handler/danwei.ashx',
            method: 'get',
            queryParams: { danweileixing: "出库单位", uid: window.uid, kid: window.kid },
            valueField: 'danwei',
            textField: 'danwei',
            panelWidth: 150,
            panelHeight: 'auto',
            editable: false
        });

        $("#ruku_tuiku_wuliaomingcheng").combobox({
            url: 'handler/wuliao.ashx',
            method: 'get',
            queryParams: { wuliaoleixing: "入库物料", uid: window.uid, kid: window.kid },
            valueField: 'id',
            textField: 'wuliao',
            panelWidth: 100,
            panelHeight: 'auto',
            editable: false,
            onSelect: function(record) {
                $("#ruku_tuiku_xinghao").combobox({
                    url: 'handler/xinghao.ashx',
                    method: 'get',
                    queryParams: { wuliaoid: record.id, uid: window.uid, kid: window.kid },
                    valueField: 'xinghao',
                    textField: 'xinghao',
                    panelWidth: 100,
                    panelHeight: 'auto',
                    editable: false
                });
            }
        });

        $("#ruku_tuiku_xinghao").combobox({
            data: [{ xinghao: '—全部—', selected: true}],
            valueField: 'xinghao',
            textField: 'xinghao',
            panelWidth: 100,
            panelHeight: 'auto',
            editable: false
        });

    });
    $.parser.onComplete = function() {
        var d = new Date();
        $("#ruku_tuiku_date_kaishi").datetimebox('setValue', d.toLocaleDateString() + " 00:00:00");
        $("#ruku_tuiku_date_jieshu").datetimebox('setValue', d.toLocaleDateString() + " 23:59:59");
    }
</script>

<div class="easyui-panel" data-options="height:110,border:false" title="数据检索" style="border-top-width: 0px;
    border-bottom-width: 1px; padding: 10px; width:100%">
    <table style="font-size: 12px;">
        <tr>
            <td>
                站点：
            </td>
            <td>
                <input class="" name="ruku_tuiku_zhandian" id="ruku_tuiku_zhandian" style="width: 175px;" />
            </td>
            <td>
                称重时间：
            </td>
            <td>
                <input id="ruku_tuiku_date_kaishi" type="text" class="easyui-datetimebox" data-options="required:true,showSeconds:true"
                    style="width: 175px">
            </td>
            <td align="center">
                至
            </td>
            <td>
                <input id="ruku_tuiku_date_jieshu" type="text" class="easyui-datetimebox" data-options="required:true,showSeconds:true"
                    style="width: 175px">
            </td>
        </tr>
        <tr>
            <td>
                单位名称：
            </td>
            <td>
                <input id="ruku_tuiku_danweimingcheng" name="ruku_tuiku_danweimingcheng" data-options="" style="width: 175px">
            </td>
            <td>
                物料名称：
            </td>
            <td>
                <input id="ruku_tuiku_wuliaomingcheng" name="ruku_tuiku_wuliaomingcheng" data-options="" style="width: 175px">
            </td>
            <td>
                型号：
            </td>
            <td>
                <input id="ruku_tuiku_xinghao" name="ruku_tuiku_xinghao" data-options="" style="width: 175px">
            </td>
            <td>
                车号：
            </td>
            <td>
                <input id="ruku_tuiku_chepaihao" name="ruku_tuiku_chehao" type="text" class="easyui-textbox"
                    data-options="" style="width: 90px">
            </td>
            <td>
                <a id="ruku_tuiku_chaxun" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                    style="width: 60px; margin-left: 20px;">查询</a>
            </td>
            <td>
                <a id="ruku_tuiku_daochu" class="easyui-linkbutton" data-options="iconCls:'icon-export-16'"
                    style="width: 60px">导出</a>
            </td>
        </tr>
    </table>
</div>
<table id="ruku_tuiku_mingxi" class="easyui-datagrid" title="入库物资退库明细" data-options="border:false,singleSelect:true,collapsible:false,fitColumns:true,striped:true" style=" width:100%">
    <thead>
        <tr>
            <th data-options="field:'tuikubianhao'">
                称重编号
            </th>
            <th data-options="field:'tuikuchepaihao'">
                车牌号
            </th>
            <th data-options="field:'tuikuwuliao'">
                物料名称
            </th>
            <th data-options="field:'tuikuxinghao'">
                型号
            </th>
            <th data-options="field:'tuikudanwei'">
                单位名称
            </th>
            <th data-options="field:'tuikujingzhong',align:'right'">
                退库净重(吨)
            </th>
            <th data-options="field:'tuikushijian'">
                退库时间
            </th>
            <th data-options="field:'tuikubeizhu'">
                退库备注
            </th>
        </tr>
    </thead>
</table>
